package com.qdlc.p2p.biz.executer.impl;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.qdlc.p2p.biz.executer.BaseExecuter;
import com.qdlc.p2p.biz.service.UserRedEnvelopeService;
import com.qdlc.p2p.common.constant.Global;
import com.qdlc.p2p.common.util.BeanUtil;
import com.qdlc.p2p.dal.dto.BorrowTender;

/**
 * 红包借款标满标复审失败
 *
 * @author ylx
 * @version 2.0
 * @date 2015年5月19日 下午2:56:46
 */
@Service
@Scope(value=ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class RedEnvelopeBorrowTenderFailExecuter extends BaseExecuter {

    @Override
    public void extend() {
        // 获取投标对象
        Object obj = Global.getTransfer().get("tender");
        if (obj != null) {
            BorrowTender tender = (BorrowTender) obj;
            UserRedEnvelopeService userRedEnvelopeService = (UserRedEnvelopeService) BeanUtil.getBean("userRedEnvelopeService");
            //还原红包状态
            userRedEnvelopeService.tenderBorrowFailUseRedEnvelope(tender);
        }
    }
}
